package com.jason.coroutines.extentions

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

fun main()= runBlocking<Unit> {
//    CoroutineScope(SupervisorJob() + Dispatchers.IO).launch {
//        delay(200)
//        printThread()
//    }
//
//    val job = GlobalScope.launch(Dispatchers.IO) {
//        delay(100)
//        printThread()
//    }
//
//    printThread()
//    job.join()

    flowOf("2",33,"aa","bbb",null,999,"111")
}
fun printThread():Unit = println("Thread name is ${Thread.currentThread().name}")

public fun <T> flowOf(vararg elements: T) =  {
    for (element in elements) {
        println("element = ${element}")
    }
}

